Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve check for invalid ICC profiles #647

Merged

Conversation

JBildstein
Copy link
Contributor

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #646
There was no check if the actual data byte array was big enough to be a valid header so it tried to read it which resulted in the exception.
This PR fixes that, adds another check if the array is big enough for the reported profile size and extends the unit test cases.

@codecov
Copy link

codecov bot commented Jul 3, 2018

Codecov Report

Merging #647 into master will increase coverage by 0.01%.
The diff coverage is 98.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #647      +/-   ##
==========================================
+ Coverage   89.31%   89.32%   +0.01%     
==========================================
  Files         893      893              
  Lines       38020    38090      +70     
  Branches     2667     2668       +1     
==========================================
+ Hits        33956    34023      +67     
- Misses       3267     3269       +2     
- Partials      797      798       +1
Impacted Files Coverage Δ
...mageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs 100% <100%> (ø) ⬆️
src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs 90.54% <87.5%> (-0.77%) ⬇️
...iles/ICC/DataReader/IccDataReader.NonPrimitives.cs 93.75% <0%> (-3.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68ca7ff...deb2990. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArgumentException on loading JPEG image
2 participants